package com.sc.pattern.worker;

/**
 * Created  on 2018/1/13.
 *
 * @author sc
 */
public class WorkThread extends Thread {
    private final Channel channel;
    public WorkThread(String name, Channel channel) {
        super(name);
        this.channel = channel;
    }

    @Override
    public void run() {
        while (true){
            try {
                channel.take().execute();
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
